package me.zingon.yourbatis.factory;

import me.zingon.yourbatis.db.DBConnection;
import me.zingon.yourbatis.db.DBPool;
import me.zingon.yourbatis.db.IDBPool;

public class DBPoolFactory {

    private static IDBPool dbPool;

    public synchronized static void build(String driver, int poolSize, String url, String user, String password) throws ClassNotFoundException {
        dbPool=new DBPool(driver,poolSize,url,user,password);
    }

    public static IDBPool getPool(){
        return dbPool;
    }

    public static DBConnection getConnection() throws Exception {
        return dbPool.getConnection();
    }
}
